package model.skill;

import model.entity.Entity;
import model.entity.stats.StatType;
import model.item.InteractiveItem;
import model.map.World;

public class DetectTrap extends NonactivateableSkill{

	public DetectTrap()
	{
		super(SkillType.DETECTTRAP, SkillType.DETECTTRAP);
	}

	public boolean getVisibility(InteractiveItem interactiveItem)
	{
		return interactiveItem.isActivated();
	}

	public void steppedInto(Entity entity)
	{
		double trapVal = entity.getStatVal(SkillType.DETECTTRAP);
		if ((int)(Math.random() * (trapVal)) + 1 <= 5)
			entity.setStat(StatType.HP, -20.0);
		else
			World.getInstance().getCurrentMap().removeItem(entity.getLocation());

	}

}

